package com.jason.quartzdemo.config;


import com.jason.quartzdemo.job.Job_A2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * spring自带定时器
 * 源码详细请看
 * 1,ReschedulingRunnable.run()
 * 2,ScheduledExecutorService
 *
 */
@Component
public class QuartzConfig2 {

    @Autowired
    Job_A2 a2;

    @Scheduled(cron = "*/5 * * * * ?")
    public void run(){
        a2.springMethod();
    }

}
